import React, { memo, useState } from 'react'

export default function App() {
    const [name, setName] = useState('miaohao');
    const [title, setTitle] = useState('HAHA')
  return (
    <div>
        <button onClick={()=>{
            setName('daming')
        }}>没效果</button>
        <button onClick={()=>{
            setTitle('lingling')
        }}>有效果</button>
        <Child title={title}></Child>
        {name}-{title}
    </div>
  )
}

const Child = memo((props)=>{   //用来做缓存
    console.log("走你")
    return (
        <div>{props.title}</div>
    )
})